#include<iostream>
using namespace std;
const int N = 3010, MOD = 2333;
int arr[N][N];
int f[N][N];
int n, m;
int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			scanf("%d", &arr[i][j]);
		}
	}
	f[n][1] = 1;
	for (int i = n; i >= 1; i--) {
		for (int j = 1; j <= m; j++) {
			if (!arr[i][j]) {
				f[i][j] += f[i + 1][j];
				f[i][j] %= MOD;
				f[i][j] += f[i][j - 1];
				f[i][j] %= MOD;
			}
		}
	}
	cout << f[1][m] % MOD << endl;
	return 0;
}